package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkKnowledgeCatalog;
import com.ysd.lis.entity.WkKnowledgeContent;
import com.ysd.lis.request.KnowledgePageParam;
import com.ysd.lis.service.WkKnowledgeContentService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author peng
 * @since 2024-03-12
 */
@Api(tags = "知识库内容")
@RestController
@RequestMapping("/api/wk/wkKnowledgeContent")
public class WkKnowledgeContentController extends BaseController {

    @Autowired
    WkKnowledgeContentService wkKnowledgeContentService;

    @GetMapping("/getContentListByCatalogId/{catalogId}")
    public Result getContentListByCatalogId(@PathVariable("catalogId") String catalogId) {
        return wkKnowledgeContentService.getContentListByCatalogId(catalogId);
    }

    @GetMapping("/getContentListById/{id}")
    public Result getContentListById(@PathVariable("id") String id) {
        return wkKnowledgeContentService.getContentListById(id);
    }

    @PostMapping("/addKnowledgeContent")
    public Result addKnowledgeContent(@RequestBody WkKnowledgeContent content){
        return wkKnowledgeContentService.addKnowledgeContent(content);
    }

    @PostMapping("/editKnowledgeContent")
    public Result editKnowledgeContent(@RequestBody WkKnowledgeContent content){
        return wkKnowledgeContentService.editKnowledgeContent(content);
    }

    @PostMapping("/submitKnowledgeContent")
    public Result submitKnowledgeContent(@RequestBody WkKnowledgeContent content){
        return wkKnowledgeContentService.submitKnowledgeContent(content);
    }


    @PostMapping("/deletKnowledgeContent")
    public Result deletKnowledgeContent(@RequestBody WkKnowledgeContent content){
        return wkKnowledgeContentService.deletKnowledgeContent(content);
    }

    @PostMapping("/batchUpdateKnowledgeContent")
    public Result batchUpdateKnowledgeContent(@RequestBody WkKnowledgeCatalog catalog){
        return wkKnowledgeContentService.batchUpdateKnowledgeContent(catalog);
    }

    @GetMapping("/getContentByContentId")
    public Result getContentByContentId(KnowledgePageParam param) {
        return wkKnowledgeContentService.getContentByContentId(param);
    }
}
